using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MagnoliaTableAdapters;

public partial class UserAccess : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        // Set up hidden user access list box for access from client side
        ListBox_UserAccess.Style.Add("display", "none");

        Magnolia.USERTYPEACCESSDataTable UserAccess = new Magnolia.USERTYPEACCESSDataTable();
        USERTYPEACCESSTableAdapter UserAccessAdapter = new USERTYPEACCESSTableAdapter();
        UserAccessAdapter.FillByUserID(UserAccess, Convert.ToInt32(Session["UserID"]));
        
        //DataTable UserAccessDT = new DataTable();
        //UserAccessDT = (DataTable)Session["UserAccess"];
        //ListBox_UserAccess.DataSource = UserAccessDT;
        //ListBox_UserAccess.DataTextField = UserAccessDT.Columns[0].ColumnName;
        //ListBox_UserAccess.DataValueField = UserAccessDT.Columns[0].ColumnName;

        ListBox_UserAccess.DataSource = UserAccess;
        ListBox_UserAccess.DataTextField = UserAccess.UserFunctionIDColumn.ColumnName;
        ListBox_UserAccess.DataValueField = UserAccess.UserFunctionIDColumn.ColumnName;

        ListBox_UserAccess.DataBind();

        TextBox_PageTitle.Style.Add("display", "none");
        TextBox_PageTitle.Text = Request.Url.AbsolutePath;
    }
}
